Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: makes instance-status works along with Moleculer lifecyle #34134

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

ricardogarim
Copy link
Contributor

@ricardogarim ricardogarim commented Dec 6, 2024

Proposed changes (including videos or screenshots)

This PR removes the use of MongoDB Change Streams on instance-status package. The removal of Change Stream items is part of an initiative started earlier this year, but resources related to instance-status were still pending.

instance-status is responsible for ensuring the connection and heartbeat between instances in a multi-instance monolithic Rocket.Chat deployment.

Since the Moleculer framework is already in use, we moved the lifecycle management of connections to it, such as node initialization, listing, etc.

As a result, it is no longer necessary to ping MongoDB and wait for a Change Stream notification to interpret a given node as valid.

The same timeout and heartbeat interval rules have been added to Moleculer:

  • heartbeatInterval: process.env.MULTIPLE_INSTANCES_PING_INTERVAL || 10
  • heartbeatTimeout: process.env.MULTIPLE_INSTANCES_EXPIRE || Math.ceil((defaultPingInterval * 3) / 60) * 60

Issue(s)

Steps to test or reproduce

To validate these changes, you will need to run a multi-instance monolithic Rocket.Chat deployment.

Navigate to the apps/meteor directory and run the following command to start the first instance:

cd apps/meteor
TEST_MODE=true CI=true DISABLE_DB_WATCHERS=true meteor

Navigate to the build directory and execute the following:

cd ./apps/meteor/.meteor/local/build
cd .. && cd build && MONGO_URL=mongodb://localhost:3001/meteor INSTANCE_IP=localhost ROOT_URL=http://localhost:3000 PORT=3030 TEST_MODE=true DB_WATCHERS_DISABLED=true node main.js

This setup runs multi-instance communication using the TCP transporter. If you prefer to use NATS, you’ll need to include the NATS_TRANSPORTER environment variable. However, the changes primarily affect TCP connections.

Further comments

Copy link
Contributor

dionisio-bot bot commented Dec 6, 2024

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

Copy link
Contributor

github-actions bot commented Dec 6, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-34134/
on branch gh-pages at 2024-12-09 20:39 UTC

Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.79%. Comparing base (486b33a) to head (8f3d074).
Report is 23 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #34134      +/-   ##
===========================================
+ Coverage    75.75%   75.79%   +0.03%     
===========================================
  Files          510      511       +1     
  Lines        22078    22132      +54     
  Branches      5387     5394       +7     
===========================================
+ Hits         16726    16775      +49     
- Misses        4706     4709       +3     
- Partials       646      648       +2     
Flag Coverage Δ
unit 75.79% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link

changeset-bot bot commented Dec 6, 2024

⚠️ No Changeset found

Latest commit: 8f3d074

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ricardogarim ricardogarim added this to the 7.2.0 milestone Dec 9, 2024
@ricardogarim ricardogarim marked this pull request as ready for review December 9, 2024 11:11
@ricardogarim ricardogarim requested review from a team as code owners December 9, 2024 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants